<?php
/**
 * 博主点击量最高资讯
 * limit 
 * dateType (1:一周内)
 * blogreadmorecontroller.php
 * Create on 2015-04-18
 * Create by yuebin
 */
namespace haibao\cms\business\control\pc\channel\blog;

use haibao\cms\business\control\PublicController as PublicControllerBusiness;

class BlogReadMoreController extends \haibao\cms\business\control\pc\channel\ChannelController{
	
	const DATE_TYPE_WEEK = 1;
	public function __construct($updateTime = null,$controlId,$isPublish){
		parent::__construct($updateTime,$controlId,$isPublish);
	}
	
	
	/**
	 * 获取模版内容
	 * @param : String $content
	 */
	public function displayTemplateHtml(){
	
		$controlData = $this->getParameter(self::$CONTROL_DATA);
		$content = $this->getParameter(self::$CONTROL_CONTENT);
		$blogArr = array();
		if($controlData['manual']){
			$category = self::getBlogCategory();
			$dateType = $controlData['manual']['dateType'];
			if($dateType == self::DATE_TYPE_WEEK){
				$blogArr = PublicControllerBusiness::getBlogByClick($dateType);
			}
			$num = 1;
			foreach($blogArr as $key=>$blog){
				$blogArr[$key]['cuttitle'] = $this->cutTitle($blog['subject'], 18);
				$blogArr[$key]['num'] = $num;
				$blogArr[$key]['url'] = \haibao\classlibrary\cms\Config::getConfig(\haibao\classlibrary\cms\Config::CLASSLIBRARY_CONFIG_HOST_BOZHU).'/blog/'.$blog['blogid'].'.htm';
				$blogArr[$key]['sitetype'] = \haibao\www\model\data\Favorite::ID_TYPE_BLOG_NUM;
				$num++;
			}
		}
		$this->assign('blogArr',$blogArr);
		$path = $this->generateHtmlPath(__CLASS__);
		$this->generateHtml($path,$content);
		$content = $this->getHtml($path);
		$content = $this->replaceCDNLink($content);
		return $content;
	}
}